<% title _("Subnets") %>

<%= javascript 'subnets' %>
<% title_actions new_link(_("Create Subnet")) %>

<table class="<%= table_css_classes 'table-fixed' %>">
  <thead>
    <tr>
      <th class="col-md-2"><%= sort :name, :as => s_("Subnet|Name") %></th>
      <th class="col-md-2"><%= sort :network, :as => s_("Subnet|Network") %></th>
      <th class="col-md-3"><%= _("Domains") %></th>
      <th class="col-md-1"><%= sort :vlanid, :as => s_('Subnet|Vlanid') %></th>
      <th class="col-md-2"><%= _("DHCP Proxy") %></th>
      <th class="col-md-1"><%= _("Hosts") %></th>
      <th><%= _('Actions') %></th>
    </tr>
  </thead>
  <tbody>
    <% @subnets.each do |subnet| %>
      <tr>
        <td class="ellipsis"><%=link_to_if_authorized subnet.name, hash_for_edit_subnet_path(:id => subnet).merge(:auth_object => subnet, :authorizer => authorizer) %></td>
        <td><%=subnet.network_address %></td>
        <td class="ellipsis"><%= subnet.domains.map(&:name).to_sentence %></td>
        <td><%= subnet.vlanid %></td>
        <td class="ellipsis"><%= subnet.dhcp %></td>
        <td><%= link_to_if_authorized(hosts_count[subnet], hash_for_hosts_path(:search => "subnet.name=\"#{subnet}\"")) %>
        <td class="col-md-1">
          <%= action_buttons(display_delete_if_authorized(
            hash_for_subnet_path(:id => subnet).
            merge(:auth_object => subnet, :authorizer => authorizer),
            :data => { :confirm => _("Delete %s?") % subnet.name })) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @subnets %>
